<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
        <link rel="stylesheet" href="/static/css/index.css">

    <script src="../static/js/jquery-3.3.1.min.js"></script>
</head>
<body>
<input type="text" name="usernam" id="username">
<input type="password" name="password" id="password">
<button id="btn">点击</button>
<script>
    $(function(){
        $("#btn").click(function(){
            var username=$('#username').val();
            var password=$('#password').val();
            var data1= {
                data: JSON.stringify({
                    'username': username,
                    'password': password
                }),
            };
                $.ajax({
                url:'http://localhost:5000/sendAjax2',
                type:'POST',
                data:data1,
                dataType: 'json',
                success:function(res){
                    console.log(res)
                    console.log(0)

                },
                error:function (res) {
                    console.log(res);
                    console.log(1)
                }

            })
        })
    })
</script>
</body>
</html>